﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Ledict.ConditionExtract.DAL;
using Ledict.ConditionExtract.Model;

namespace Ledict.ConditionExtract.BLL
{
    public class Express_WordBLL
    {
        Ledict.ConditionExtract.DAL.Express_WordDAL worddel = new Express_WordDAL();
        WordBankKeyWordsBLL wordbankkeywordsbll = new WordBankKeyWordsBLL();
        WordBankBLL wordbankbll = new WordBankBLL();
        CreateIndexDal _createIndexDal = new CreateIndexDal();
        #region ExpressWord
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists_Word(SYS_Express_Word Model)
        {
            return worddel.Exists_Word(Model);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add_Word(SYS_Express_Word Model)
        {

            return worddel.Add_Word(Model);
        }

        /// 修改IsSingleExpress字段为0（表示该条数据被多个节点所匹配）
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool UpdateWord_ProcessIsSingleExpress(int EW_IsSingleExpress, string MS_ID, string EW_ID)
        {
            return worddel.UpdateWord_ProcessIsSingleExpress(EW_IsSingleExpress, MS_ID, EW_ID);
        }

        public bool Delete_Word(string EW_ID)
        {
            return worddel.Delete_Word(EW_ID);
        }

        /// <summary>
        /// 根据主键删除SYS_Express_Word
        /// </summary>
        /// <param name="EW_ID"></param>
        /// <returns></returns>
        public bool DeleteEwID(string EW_ID)
        {
            return worddel.DeleteEwID(EW_ID);
        }

        public bool UpdateEW_IsAvailable(string EW_ID, int EW_IsAvailable)
        {
            return worddel.UpdateEW_IsAvailable(EW_ID, EW_IsAvailable);
        }

        #endregion
        #region ExpressWordProcess

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public string Exists_WordProcess(SYS_Express_Word Model)
        {
            return worddel.Exists_WordProcess(Model);
        }

        /// <summary>
        /// 表述语句中是否存在该记录
        /// </summary>
        public bool IsExistsData(SYS_Express_Word WordModel)
        {
            return worddel.IsExistsData(WordModel);
        }

        /// <summary>
        /// 验证是否存在该纪录（争议焦点专用）
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public string Exists_WordProcess1(SYS_Express_Word Model)
        {
            return worddel.Exists_WordProcess1(Model);
        }

        /// <summary>
        /// 添加句
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool AddWord_Process(SYS_Express_Word Model)
        {
            return worddel.AddWord_Process(Model);
        }
        /// <summary>
        /// 已存在修改次数，要素词
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool UpdateWord_Process(SYS_Express_Word Model)
        {
            return worddel.UpdateWord_Process(Model);
        }

        public bool UpdateWordProcess(SYS_Express_Word Model)
        {
            return worddel.UpdateWordProcess(Model);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SYS_Express_Word GetModel_Process(string EW_ID)
        {
            return worddel.GetModel_Process(EW_ID);
        }

        public bool UpdateCC_IsShowExpress(string ID, int state)
        {
            return worddel.UpdateCC_IsShowExpress(ID, state);
        }


        public bool IswordBankKeys(string headword, string wordBankKeys)
        {
            return worddel.IswordBankKeys(headword, wordBankKeys);
        }


        /// <summary>
        /// 所有节点的表述中的字典词组
        /// </summary>
        /// <param name="CCID"></param>
        /// <returns></returns>
        public DataTable GetAllwordBankKeys(string CCID)
        {
            return worddel.GetAllwordBankKeys(CCID);
        }

        public bool UpdateChooseState_Process(SYS_Express_Word Model)
        {
            return worddel.UpdateChooseState_Process(Model);
        }

        public bool UpdateAddElement_Process(string EW_ID, string EW_AddElement)
        {
            return worddel.UpdateAddElement_Process(EW_ID, EW_AddElement);
        }
        /// <summary>
        /// 两个表
        /// </summary>
        /// <param name="EW_ID"></param>
        /// <param name="EW_Content"></param>
        /// <returns></returns>
        public bool UpdateContent(string EW_ID, string EW_Content)
        {

            return worddel.UpdateContent(EW_ID, EW_Content);
        }

        public bool UpdateClearElement_Process()
        {
            return worddel.UpdateClearElement_Process();
        }

        public bool Delete_WordProcess(string EW_ID)
        {
            return worddel.Delete_WordProcess(EW_ID);
        }

        #endregion

        #region Index

        /// <summary>
        /// 根据案例ID和逻辑段类型ID，查询逻辑段内容
        /// </summary>
        /// <param name="caseId">案例ID</param>
        /// <param name="paragraphTypeId">逻辑段类型ID</param>
        /// <returns></returns>
        public DataTable GetCaseParagraphLogic(int caseId, int paragraphTypeId)
        {
            return _createIndexDal.GetCaseParagraphLogic(caseId, paragraphTypeId);
        }

        #endregion


        public bool AddSYS_Express_SituationWordRel(string ES_IDs, string EW_ID)
        {
            return worddel.AddSYS_Express_SituationWordRel(ES_IDs, EW_ID);
        }

        public DataTable GetExractContent(string id, string sort, string asc, string SelectText, string SelectWBK_ID, int effective)
        {
            return worddel.GetExractContent(id, sort, asc, SelectText, SelectWBK_ID, effective);


        }

        /// <summary>
        /// 根据MSID获取表数据
        /// </summary>
        /// <param name="msId"></param>
        /// <returns></returns>
        public DataTable GetExtractContentByMsID(string msId)
        {
            return worddel.GetExtractContentByMsID(msId);
        }


        public DataTable GetExtractContentByMsID(string ccId, string AffirmIdeaResult)
        {
            return worddel.GetExtractContentByMsID(ccId, AffirmIdeaResult);
        }
        /// <summary>
        /// 获取表述加工数据
        /// </summary>
        /// <param name="ms_Id"></param>
        /// <param name="isSingleExpress"></param>
        /// <returns></returns>
        public DataTable GetExtraceContent(string ms_Id, int isSingleExpress)
        {
            return worddel.GetExtraceContent(ms_Id, isSingleExpress);
        }

        public DataTable GetExpressContent(string id, string msid, int isSingle, string sort, string IsASC, string SelectText)
        {
            return worddel.GetExpressContent(id, msid, isSingle, sort, IsASC, SelectText);


        }

        public DataTable GetExpressContent(string id)
        {
            return worddel.GetExpressContent(id);
        }

        /// <summary>
        /// 获取组合节点表述
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DataTable GetExpressContent1(string id)
        {
            return worddel.GetExpressContent1(id);
        }
        /// <summary>
        /// 查询和词库关联的数据
        /// </summary>
        /// <param name="WBK_ID"></param>
        /// <param name="MS_ID"></param>
        /// <returns></returns>
        public DataTable GetExractContent_Wordbook(string WBK_ID, string MS_ID)
        {
            return worddel.GetExractContent_Wordbook(WBK_ID, MS_ID);
        }

        public DataTable GetExractContent_AddWord(string id, string ElementWord)
        {
            return worddel.GetExractContent_AddWord(id, ElementWord);
        }


        /// <summary>
        /// 删除表述节点及其表述内容
        /// </summary>
        /// <param name="CC_ID">节点id</param>
        /// <returns></returns>
        public bool DeleteSYS_Express_Word_Process(string CC_ID)
        {
            return worddel.DeleteSYS_Express_Word_Process(CC_ID);
        }

        /// <summary>
        /// 插入删除日志
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="tableKey"></param>
        /// <param name="tableKeyValue"></param>
        /// <returns></returns>
        public bool InsertDeleteLog(string tableName, string tableKey, string tableKeyValue)
        {
            return worddel.InsertDeleteLog(tableName, tableKey, tableKeyValue);
        }

        /// <summary>
        /// 删除表述节点及其表述内容
        /// </summary>
        /// <param name="CC_ID">节点id</param>
        /// <returns></returns>
        public bool DeleteSYS_Express_Word_ProcessMinshi(string CC_ID)
        {
            return worddel.DeleteSYS_Express_Word_ProcessMinshi(CC_ID);
        }

        /// <summary>
        /// 添加句
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool AddWordProcessNew(SYS_Express_Word Model)
        {
            return worddel.AddWordProcessNew(Model);
        }

        /// <summary>
        /// 添加分词分析语句
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool AddWordAnalysis(string strSql)
        {
            return worddel.AddWordAnalysis(strSql);
        }



        /// <summary>
        /// 修改word的钩和差
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool UpdateWordProcessNew(string ewId, int type, string remark = "")
        {
            return worddel.UpdateWordProcessNew(ewId, type, remark);
        }

        /// <summary>
        /// 获取表述加工数据
        /// </summary>
        /// <param name="ms_Id"></param>
        /// <param name="isSingleExpress"></param>
        /// <returns></returns>
        public DataTable GetExtraceContentNew(string msID, int pagesize, int pageIndex, string condition)
        {
            return worddel.GetExtraceContentNew(msID, pagesize, pageIndex, condition);
        }

        /// <summary>
        /// 获取相似度数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public DataTable GetXSData(string ewID)
        {
            return worddel.GetXSData(ewID);
        }

        /// <summary>
        /// 获取需要重新处理的数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public int GetProcessCaseCount(string ccID, string condition)
        {
            return worddel.GetProcessCaseCount(ccID, condition);
        }

        /// <summary>
        /// 获取民事智能数据部用数据
        /// </summary>
        /// <param name="msID">节点ccid</param>
        /// <param name="pagesize">每页显示条数</param>
        /// <param name="pageIndex">第几页</param>
        /// <returns></returns>
        public DataTable GetGPCData(string msID, int zongNum)
        {
            return worddel.GetGPCData(msID, zongNum);
        }


        /// <summary>
        /// 重新处理时删除数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool DeleteProcessNew(string ccID, Int32 paragraphTypeId)
        {
            return worddel.DeleteProcessNew(ccID, paragraphTypeId);
        }

        /// <summary>
        /// 重新处理时删除数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool DeleteProcessNew1(string ccID)
        {
            return worddel.DeleteProcessNew1(ccID);
        }

        /// <summary>
        /// 获取需要重新处理的数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public DataTable GetProcessNew(string ccID, int paragraphTypeId)
        {
            return worddel.GetProcessNew(ccID, paragraphTypeId);
        }

        /// <summary>
        /// 获取需要重新处理的数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public DataTable GetProcessNew1(string ccID)
        {
            return worddel.GetProcessNew1(ccID);
        }

        /// <summary>
        /// 获取需要重新处理的数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public int GetProcessCount(string ccID)
        {
            return worddel.GetProcessCount(ccID);
        }

        /// <summary>
        /// 导出当前节点的数据
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public DataSet DaoChuData(string ccID, int type)
        {
            return worddel.DaoChuData(ccID, type);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public string Exists_WordProcessCase(SYS_Express_Word_ProcessCase Model)
        {
            return worddel.Exists_WordProcessCase(Model);
        }

        /// <summary>
        /// 添加SYS_Express_Word_ProcessCase表
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool AddSYS_ExpressWordProcessCase(SYS_Express_Word_ProcessCase Model)
        {
            return worddel.AddSYS_ExpressWordProcessCase(Model);
        }

        /// <summary>
        /// 已存在修改次数
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool UpdateWord_ProcessCase(string ewId)
        {
            return worddel.UpdateWord_ProcessCase(ewId);
        }

        /// <summary>
        /// 修改数据标记
        /// </summary>
        /// <param name="eWIDs"></param>
        /// <param name="dataSign"></param>
        /// <returns></returns>
        public bool UpdateProcessCaseDataSign(string eWIDs, string dataSign)
        {
            return worddel.UpdateProcessCaseDataSign(eWIDs, dataSign);
        }

        /// <summary>
        /// 获取案由下的msids
        /// </summary>
        /// <param name="causeId"></param>
        /// <returns></returns>
        public DataTable GetMSIDS(string causeId)
        {
            return worddel.GetMSIDS(causeId);
        }

        /// <summary>
        /// 获取ewId和内容
        /// </summary>
        /// <param name="causeId"></param>
        /// <returns></returns>
        public DataTable GetEwIdAndContent(string causeId)
        {
            return worddel.GetEwIdAndContent(causeId);
        }

        /// <summary>
        /// 修改数据标记
        /// </summary>
        /// <param name="eWIDs"></param>
        /// <param name="dataSign"></param>
        /// <returns></returns>
        public bool UpdateProcessFlag(string eWID)
        {
            return worddel.UpdateProcessFlag(eWID);
        }

        /// <summary>
        /// 修改数据标记
        /// </summary>
        /// <param name="eWIDs"></param>
        /// <param name="dataSign"></param>
        /// <returns></returns>
        public bool UpdateProcessFlag(string parenteWID, string eWID)
        {
            return worddel.UpdateProcessFlag(parenteWID, eWID);
        }

        /// <summary>
        /// 获取智慧检务用筛选数据
        /// </summary>
        /// <param name="msID"></param>
        /// <returns></returns>
        public DataTable GetMSID(string msID)
        {
            return worddel.GetMSID(msID);
        }

        /// <summary>
        /// 表述库加工用
        /// </summary>
        /// <param name="msid"></param>
        /// <returns></returns>
        public DataTable GetExpressWordData2(string msid)
        {
            return worddel.GetExpressWordData2(msid);
        }

    }
}
